<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>订单列表</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet"
	href="<%=path%>/lib/bootstrap/css/bootstrap.min.css" />
	<script type="text/javascript" src="<%=path%>/lib/jquery-1.8.1.min.js"></script>
	<script type="text/javascript"
	src="<%=path%>/lib/bootstrap/js/bootstrap.min.js"></script>
	<link rel="stylesheet" type="text/css" href="<%=path%>/css/xcConfirm.css"/>
	<script src="<%=path%>/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" src="<%=basePath%>lib/jquery-1.7.2.min.js"></script>
<%-- 	<script type="text/javascript" src="<%=basePath%>js/kkpager.js"></script> --%>
	<script type="text/javascript" src="<%=basePath%>js/jpager.js"></script>
<%-- 	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/kkpager_orange.css" /> --%>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/jpager.css" />
<script type="text/javascript" src="<%=basePath%>js/listpage.js"></script>
  </head>
  
  <body>
   	<h2 style="padding: 3%;">订单列表</h2>
	<div class="container">
		<div class="row clearfix">
			<div class="col-md-12 column">
			<div id="jpager"></div>
			<input type="text" class="search-query" name="" placeholder="输入角色类型 / 角色名称" style="height: 3%;"/>
			
			<input type="button" class="btn btn-primary" name="serchAuthor" value="查询"/>
			<div style="float: right;"><input type="button" class="btn btn-success" data-toggle="modal" data-target="#addAuthorModal" onclick="choose='add'" value="下单"/></div>
				<table class="table table-hover">
					<thead>
						<tr>
							<th>编号</th>
							<th>菜品名称</th>
							<th>价格</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${dishes}" var="dishe" varStatus="col">
							<tr class="${col.count%2==0?'':'info' }">
								<td>${dishe.dishesno }</td>
								<td>${dishe.dishesname }</td>
								<td>${dishe.price }</td>
									<td >
										<input type="checkbox"/>
									</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
					 <ul class="pager">
						  <li class="previous ${pageNo==1?'disabled':''}">
							  <c:if test="${pageNo==1}">
							  	<a>上一页</a>
							  </c:if>
							  <c:if test="${pageNo!=1}">
							  	<a href="dishesList.action?pageNo=${pageNo-1 }">上一页</a>
							  </c:if>
						  </li>
						  
						  <li style="text-align: center;">${pageNo}</li>
						  
						  <li class="next ${dishes.size()%pageSize!=0?'disabled':''}">
							  <c:if test="${dishes.size()%pageSize!=0}">
							  		<a>下一页</a>
							  </c:if>
							  <c:if test="${dishes.size()%pageSize==0}">
							  		<a href="dishesList.action?pageNo=${pageNo+1 }">下一页</a>
							  </c:if>
						  </li>
					</ul> 
					
				
			</div>
		</div>
	</div>
	<div class="" style="height: 768px;"></div>
<div class="modal fade" id="addAuthorModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title">
					权限管理
				</h4>
			</div>
			<div class="modal-body" style="text-align: center;">
				<input type="text" name="authorName" placeholder="权限名" style="width: 220px;height:29px"/>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-success" id="author">确认</button>
			</div>
		</div>
	</div>
</div>
	<script type="text/javascript">
		var choose = "";
		var authorityId = "";
		//权限操作
		$("#author").click(function(){
			var authorName = $("input[name=authorName]").val();
			if(authorName==""){
				alert("权限名不能为空!");
				return false;
			}
			$.ajax({
				type:"post",
				url:"author.action",
				data:{"authorId":authorityId,"authorName":authorName,"choose":choose},
				async:false,
				complete:function(result){
					if(result.responseText=="yes"){
						window.location.href="authorityList.action";
					}
				}
				
			});
		});
		function deleteAuthority(authorId){
			if(!confirm("确认删除?")){
				return false;
			};
			$.ajax({
				type:"post",
				url:"author.action",
				data:{"authorId":authorId,"choose":choose},
				async:false,
				complete:function(result){
					if(result.responseText=="yes"){
						window.location.href="authorityList.action";
					}else{
						alert("删除失败!");
					}
				}
			});
		}
	</script>

   	 <script src="js/canvas-nest.min.js" count="200" zindex="-2" opacity="0.5" color="47,135,193" type="text/javascript"></script>
  </body>
</html>
